package org.chameleon.monitor;


import java.net.InetAddress;
import java.net.UnknownHostException;

public interface MonitorData {

    /**
     * 获取监控对象名称
     *
     * @return
     */
    default String monitorObjectName() {
        return this.getClass().getSimpleName();
    }

    /**
     * 获取监控对象的ip
     *
     * @return
     */
    default String monitorObjectHost() {
        InetAddress local = null;
        try {
            local = InetAddress.getLocalHost();
            final String hostAddress = local.getHostAddress();
            return hostAddress;
        } catch (UnknownHostException e) {
            return "";
        }
    }


}
